// ComDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DocTest.h"
#include "ComDlg.h"
#include "afxdialogex.h"


// CComDlg dialog

IMPLEMENT_DYNAMIC(CComDlg, CDialog)

CComDlg::CComDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CComDlg::IDD, pParent)
{

}

CComDlg::~CComDlg()
{
}

void CComDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COM_COMBO, m_ComCombo);
}


BEGIN_MESSAGE_MAP(CComDlg, CDialog)
	ON_CBN_SELCHANGE(IDC_COM_COMBO, &CComDlg::OnCbnSelchangeComCombo)
	ON_WM_CREATE()
END_MESSAGE_MAP()


// CComDlg message handlers

static const char* szComName[4] =
{
	"COM1", "COM2", "COM3", "COM4",
};


void CComDlg::OnCbnSelchangeComCombo()
{
	// TODO: Add your control notification handler code here
	int sel = m_ComCombo.GetCurSel();

	const char* szComPort = szComName[sel];

}


int CComDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here

	return 0;
}

BOOL CComDlg::OnInitDialog()
{
	if(!CDialog::OnInitDialog())
		return FALSE;

	for(int i = 0; i < 4; i++)
	{
		m_ComCombo.AddString(szComName[i]);
		m_ComCombo.SetItemData(i, i);
	}

	return TRUE;
}
